package com.qf.test;

import com.qf.bean.Users;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.*;

/**
 * 2019/11/11
 * Administrator
 * spring1111
 * 面向对象面向君  不负代码不负卿
 */
public class Demo3 {
    public static void main(String[] args) {
      //直接获得spring容器中的对象
          //1.加载spring配置文件
        ApplicationContext app= new ClassPathXmlApplicationContext("spring1112.xml");
        Users u=(Users) app.getBean("u4");
        String[] strs = u.getStrs();
        for (String str : strs) {
            System.out.println(str);
        }
        System.out.println("----------------------------");
        List ulist = u.getUlist();
        for (Object o : ulist) {
            System.out.println(o);
        }
        System.out.println("----------------------------");
        Set uset = u.getUset();
        Iterator iterator = uset.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("----------------------------");
        Map umap = u.getUmap();
        Set<Map.Entry> set = umap.entrySet();
        for (Map.Entry entry : set) {
            System.out.println(entry);
        }
        System.out.println("----------------------------");
        Properties properties = u.getProperties();
        System.out.println(  properties.getProperty("driver"));
        System.out.println(  properties.getProperty("url"));
    }
}
